export function setClipboard(text) {
  console.log(navigator);
  navigator.clipboard.writeText(text).then(function() {
    window.Message({ message: '复制成功', type: 'success' });
  }, function() {
    window.Message({ message: '复制失败', type: 'error' });
  });
}

//定义时间格式化函数：
export function handleTime(time, format) {
  if (time == null || time == undefined || time == '') {
    return '';
  }
  var t = new Date(time);
  var tf = function (i) {
    return (i < 10 ? '0' : '') + i
  };
  return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) {
    switch (a) {
    case 'yyyy':
      return tf(t.getFullYear());
    case 'MM':
      return tf(t.getMonth() + 1);
    case 'mm':
      return tf(t.getMinutes());
    case 'dd':
      return tf(t.getDate());
    case 'HH':
      return tf(t.getHours());
    case 'ss':
      return tf(t.getSeconds());
    }
  })
}